<template>
	<view class="body">
		<form class="uni-form" @submit="formSubmit">
			<view class="uni-form-item uni-column">
				<label class="title"><text style="color:red;">⁎</text>姓名</label>
				<input class="uni-input" type="text" disabled v-model="userInfo.AAC003" placeholder-class="placeholder" />
			</view>
			<view class="uni-form-item uni-column">
				<label class="title"><text style="color:red;">⁎</text>身份证号</label>
				<input class="uni-input" type="idcard" disabled v-model="userInfo.AAC002" placeholder-class="placeholder" />
			</view>
			<view class="uni-form-item uni-column">
				<label class="title">社保卡号</label>
				<input class="uni-input" type="idcard" disabled v-model="userInfo.AAZ500" placeholder-class="placeholder" />
			</view>
			<view class="uni-form-item uni-column">
				<label class="title"><text style="color:red;">⁎</text>联系电话</label>
				<input class="uni-input" type="number" maxlength="11" @confirm="regPhone" @blur="regPhone" v-model="userInfo.AAE005" placeholder-class="placeholder" />
			</view>
			<view class="uni-form-item uni-column">
				<label class="title">联系人</label>
				<input class="uni-input" type="text" v-model="userInfo.AAE004" placeholder-class="placeholder" />
			</view>

			<view class="uni-form-item uni-column">
				<label class="title">转院类型</label>
				<input class="uni-input" type="text" disabled v-model="userInfo.ZYLX" placeholder-class="placeholder" />
			</view>
			<view class="uni-form-item uni-column">
				<label class="title">转外原因</label>
				<input class="uni-input" type="text" v-model="userInfo.AKC030" placeholder-class="placeholder" />
			</view>
			<view class="uni-form-item uni-column">
				<label class="title"><text style="color:red;">⁎</text>就医地</label>
				<view class="uni-input my-picker" @tap="openPopup('province')">{{userInfo.AKC801_NAME}}</view>
			</view>
			<view class="uni-form-item uni-column">
				<label class="title">转出医疗机构</label>
				<view class="uni-input my-picker" @tap="openPopup('out')">{{userInfo.ZCJGMC}}</view>
			</view>
			<view class="uni-form-item uni-column">
				<label class="title">转往医疗机构</label>
				<view class="uni-input my-picker" @tap="openPopup('in')">{{userInfo.ZWJGMC}}</view>
			</view>
			<view class="uni-form-item uni-column">
				<label class="title"><text style="color:red;">⁎</text>申报日期</label>
				<picker mode="date" class="my-picker" :value="userInfo.AAE127">
					<view class="uni-input">{{userInfo.AAE127}}</view>
				</picker>
			</view>
			<view class="uni-form-item uni-column">
				<label class="title"><text style="color:red;">⁎</text>待遇开始日期</label>
					<view class="uni-input" :value="userInfo.AAE030" @click="onShowDatePicker('AAE030')">{{userInfo.AAE030}}</view>
				</picker>
			</view>
			<view class="uni-form-item uni-column">
				<label class="title"><text style="color:red;">⁎</text>待遇终止日期</label>
				<view class="uni-input" :value="userInfo.AAE031" @click="onShowDatePicker('AAE031')">{{userInfo.AAE031}}</view>
			</view>
			<view class="uni-form-item uni-column">
				<label class="title"><text style="color:red;">⁎</text>人员类别</label>
				<picker class="my-picker" :value="userInfo.AKAIndex085" :range="renyuanArr" range-key="AAA103" mode="selector"
				 @change="changeRenyuan">
					<view class="uni-input">{{userInfo.AKA085_NAME}}</view>
				</picker>
			</view>
			<view class="uni-form-item uni-column">
				<label class="title"><text style="color:red;">⁎</text>险种类型</label>
		<!-- 		<picker class="my-picker" :value="userInfo.AAEIndex140" :range="xianzhongArr" range-key="AAA103" mode="selector"
				 @change="changeXianzhong">
					<view class="uni-input">{{userInfo.AAE140_NAME}}</view>
				</picker> -->
				<view class="uni-input">{{userInfo.AAE140_NAME}}</view>
			</view>
			<view class="uni-form-item uni-column">
				<label class="title">备注</label>
				<textarea :value="userInfo.BZ" />
				</view>
			<view class="uni-form-item  uni-column">
				<view class="add-icon">
					<image @tap="chooseImg" class="add-Img" src="../../static/image/addImg.png" mode="aspectFit"></image>
				</view>
				<view class="image-wrap" >
					<view class="image-item" :class="{'hover-image':currentIndex==imgIndex}"  v-for="(image,imgIndex) in imageArr" :key="imgIndex">
						<view class="close" @tap="deleteImg(imgIndex)">
							<image style="width:50upx;" src="../../static/image/error.png" mode="widthFix"></image>
						</view>
						<image style="width: 100%;height: 100%;" :data-index="imgIndex"  @tap="showCloseBtn($event)"  :src="image" mode="scaleToFill"></image>
					</view>
				</view>
			
			</view>
			<mx-date-picker :show="showPicker" type="date" format="yyyy-mm-dd" @confirm="onSelected" @cancel="onCancel" />
			
			<button type="primary" :disabled="!isLogin" form-type="submit" style="margin-top: 30upx;width: 100%;">上传</button>
		</form>
		
		<!-- 机构 -->
		<uni-popup class="my-popup" ref="popup" type="bottom">
			<view class="top">
				<view class="button-toolbar">
					<text style="color:#888;" @click="closePopup">取消</text>
					<text style="color:rgb(51, 153, 255);" @click="confirmPopup">确定</text>
				</view>
				<view class="value-text">
					<view class="text-val" @tap="rechangeHos(0)" >{{hosIndex[0].AREA_NAME}}</view> 
					<view class="text-val" @tap="rechangeHos(1)"> {{hosIndex[1].AREA_NAME}}</view> 
					<view class="text-val" @tap="rechangeHos(2)"> {{hosIndex[2].AREA_NAME}}</view>
					<view class="text-val"  v-show="hosArr.length">{{hosIndex[3].AREA_NAME}}</view>
					
					
<!-- 					<text class="text-val" @tap="rechangeHos(0)" v-show="provinceArr.length">111 {{hosIndex[0].AREA_NAME}}</text>
					<text class="text-val" @tap="rechangeHos(1)" v-show="cityArr.length">{{hosIndex[1].AREA_NAME}}</text>
					<text class="text-val" @tap="rechangeHos(2)" v-show="areaArr.length">{{hosIndex[2].AREA_NAME}}</text> -->
					<!-- <text v-show="hosArr.length">{{hosIndex[3].AREA_NAME}}</text> -->
				</view>				
			</view>

			<scroll-view class="uni-scroll-view-list" scroll-y lower-threshold="50" @scrolltolower="loadMore">
				<radio-group @change="radioChange">
						<label class="uni-list-cell uni-list-cell-pd" v-for="(item,index1) in targetArr" :key="index1">
							<view class="border-bottom:1px solid #F2F6FC;">
								<radio :value="item.AREA_CODE"  :checked="current == item.AREA_CODE" />
								{{item.AREA_NAME}}
							</view>
						</label>
				</radio-group>
				<view class="content-body" v-if="!targetArr.length" style="text-align: center;padding-top: 35px;padding-right:17px;">
					<image src="../../static/image/order.png" mode="widthFix" style="width:180upx;"></image>
				</view>
				
			</scroll-view>	
		</uni-popup>
	</view>
</template>

<script>
	import uniPopup from "@/components/uni-popup/uni-popup.vue";
	import { pathToBase64, base64ToPath } from '@/config/images-tools.js'
	import MxDatePicker from "@/components/mx-datepicker/mx-datepicker.vue";

	export default {
		components: { uniPopup,MxDatePicker},
		data() {
			return {
				showPicker: false,
				inputName:'AAE030',
				currentIndex:null,
				targetOrg:'',
				hosIndex:[{AREA_CODE:'',AREA_NAME:'请选择'},{AREA_CODE:'',AREA_NAME:''},{AREA_CODE:'',AREA_NAME:''},{AREA_CODE:'',AREA_NAME:''}],
				targetArr:[],
				targetIndex:0,
				provinceArr:[],
				cityArr:[],
				areaArr:[],
				hosArr:[],
				userInfo:{
                    AAC002:'',			//身份证号码
					AAC003:'',			//姓名
					AAZ500:'',          //社保卡号
					AAE005:'',			//电话
					AAE004:'',			//联系人
					ZYLX:'',			//转院类型
					ZWYY:'',			//转外原因
					AAZ267:'',          //备案编号
					ZCJGMC:'',			//转出医疗机构名称
					ZCJGDM:'',			//转出医疗机构代码
					ZWJGMC:'',			//转往医疗机构名称
					ZWJGDM:'',			//转往医疗机构代码
					AAE030:'',			//待遇开始日期
					AAE031:'',			//待遇终止日期
					AAE127:this.$common.getDate(new Date()),//申报日期
					
					AKC803:'',			//参保地行政区域代码
					
					AKC801:'',			//就医地行政区划代码
					AKC801_NAME:'',			//就医地行政区划名称
					
					AAE006:'',			//异地居住地址
					AKA085:'2',			//人员类别
					AKA085_NAME:'',		//人员名称
					AKAIndex085:null,
					
					AAE140:'',			//险种类型
					AAE140_NAME:'',		//险种类型名称
					AAEIndex140:null,		
					
					BG_FLAG:'1',			//	变更标志
					BZ:'',				//备注
				},
				citySet: {
					defaultValue: [0, 0, 0]
				},
				Loginer:null,
				isLogin:true,
				current:'',
				imageArr:[],
				imageNameArr:[],
				pageFlag:false,
				pageIndex:1,
				totalPage:1,
				renyuanArr:[],
				xianzhongArr:[],
				status:'more',
				imageLoad:false,
				contentText: {
					contentdown: '查看更多',
					contentrefresh: '加载中',
					contentnomore: '没有更多'
				}
			}
		},
		computed:{
			allArr:function(){
				return [this.provinceArr,this.cityArr,this.areaArr,this.hosArr]
			}
		},
		methods: {
			// 验证手机号
			regPhone(){
				var reg = this.$common.isPhoneNumber(this.userInfo.AAE005);
				var msg = this.userInfo.AAE005?'请填写正确的手机号':'请填写手机号'
				console.log(reg);
				if(!reg){
					uni.showToast({
						title: msg,
						icon: 'none',
						duration: 2000,
					});
					return false;
				}else{
					return true;
				}
			},
			//医院加载更多
			loadMore(){
				console.log(this.targetIndex)
				if(this.targetIndex==3){
					if(this.pageIndex<this.totalPage){
						this.pageIndex++;
						if(this.pageIndex>this.totalPage){
							this.pageIndex=this.totalPage;
						}
						this.getHospital(this.current);
					}else{
						uni.showToast({
							title:'没有更多',
							image:'../../static/image/info.png'
						})
					}
				}
			},
			// 拍照
			takePhoto(){
				var self = this;
				if(self.imageArr.length >= 3){
					self.$common.errorToShow("只能选择三张图片")
					return;
				}
				uni.chooseImage({
					count: 1,
					sizeType: ["compressed"],
					sourceType: ["camera"],
					success(res) {
						Promise.all(res.tempFilePaths.map(path => pathToBase64(path)))
						  .then(res2 => {
							self.imageArr = self.imageArr.concat(res2);
						  })
						  .catch(error => {
						    console.error(error)
						  })
					}
				})
			},
			// 相册
			album(){
				var self = this;
				if(self.imageArr.length >= 3){
					self.$common.errorToShow("只能选择三张图片")
					return;
				}
				uni.chooseImage({
					count: 1,
					sizeType: ["compressed"],
					sourceType: ["album"],
					success(res) {
						// 并行
						Promise.all(res.tempFilePaths.map(path => pathToBase64(path)))
						  .then(res2 => {
							self.imageArr = self.imageArr.concat(res2);
						  })
						  .catch(error => {
						    console.error(error)
						  })
						  
					}
				})
			},
			chooseImg(){
				var self = this;
				uni.showActionSheet({
				    itemList: ['拍照', '相册'],
				    success: function (res) {
						if(res.tapIndex=='0'){
							self.takePhoto();
						}else if(res.tapIndex=='1'){
							self.album();
						}
				    },
				    fail: function (res) {
				    }
				});
			},
			loadImages(AAZ267,AAC002){
				const self = this;
				if(self.imageLoad){
					return;
				}
				self.$request('S1018', {
					AAZ267: AAZ267,
					AAC002: AAC002
					} ,'POST',function(res){
						if (res.data.CODE == '0'){
							for(var i=0;i<res.data.DATA.length;i++){
								var info = res.data.DATA[i];
								self.imageArr.push(info.FJINFO)
								self.imageNameArr.push(info.FJ_NAME)
							}
						}
				})
				
			},
			deleteImages(imgIndex){
				 const self = this;
				 self.$request('S1017', {
				 	AAZ267: self.Loginer.AAZ267,
				 	AAC002: self.Loginer.AAC002,
					FJ_NAME:self.imageNameArr[imgIndex]
				 	} ,'POST',function(res){
				 		if (res.data.CODE == '0'){
				 			_.pull(self.imageArr,self.imageArr[imgIndex]);
				 		}else{
							self.$common.errorToShow("删除失败请重试")
						}
				 })
			},
			formSubmit(){
				var self = this;
				var arr={
					AAC003:'姓名',				//
				    AAC002:'身份证号',
					AAE005:'联系电话',
					AAE030:'待遇开始日期',
				    AAE031:'待遇终止日期',
					AKC801:'就医地',
				    AAE127:'申报日期'
				};
							
				for(var key in arr){
					if(key!="AAE005"&&this.userInfo[key] == ''){
						self.$common.errorToShow("请完善"+arr[key]+'信息')
						return false;
					}else if(key=="AAE005"){
						var result = this.regPhone();
						if(!result){
							return false;
						}
					}
				}
			this.userInfo.AAE030 = this.userInfo.AAE030.replace(/-/g,"");
			this.userInfo.AAE031 = this.userInfo.AAE031.replace(/-/g,"");
			this.userInfo.AAE127 = this.userInfo.AAE127.replace(/-/g,"");
			for(var i=0;i<this.imageArr.length;i++){
				this.userInfo['FJ'+(i+1)] = this.imageArr[i]
			}
			console.log(this.userInfo);
			this.$request('S1003',this.userInfo,'POST',function(res){
			    	console.log(res);
				   if(res.data.CODE == "0"){
						//if(self.imageArr == 0){
							self.$common.successToShow("上传成功",function(){
								uni.switchTab({
									url: "../index/index"
								});
							})
						
				    }else{
					  self.$common.errorToShow(res.data.MSG);
					}
			})
			},
			onShowDatePicker(type) {
				 this.showPicker = true;
				 this.inputName = type;
			},
			 onSelected(e) {//选择
			      this.showPicker = false;
			      if(e) {
					  his.userInfo[this.inputName] = e.value
				  }
			},
			
			changeShow(name) {
				this.$refs[name].show();
			},
			confirm(res) {
				this.userInfo.target = res.data.label;
			},
			fillHospital(){
				uni.hideKeyboard();
				if(uni.getStorageSync('isLogin')){
					this.transferOut('');
				}else{
					uni.showToast({
						title: '请登录',
						icon:'none',
						duration: 2000
					});
					return false;
				}
			},
			ChangeHospital(e){
			},
			transferOut(code){
				var self = this;
				// 发起注册/登录的请求
				this.$request('S1012',{"AREA_CODE":code},'POST',
					function(res){
						console.log("调用成功",res);
					
						if(res.data.CODE==0){
							var newArr = [];
							if(self.targetOrg!='province'){
								newArr = ([{AREA_CODE: code+" ",AREA_NAME: "全部"}]).concat(res.data.DATA);
							}else{
								newArr = res.data.DATA;
							}
							if(self.targetIndex==1||self.targetIndex==2){
								self.targetArr = newArr;
							}else{
								self.targetArr = res.data.DATA;
							}
							
							if(self.targetIndex==0){
								self.provinceArr = res.data.DATA;
							}else if(self.targetIndex==1){
								self.cityArr = newArr;
							}else if(self.targetIndex==2){
								self.areaArr = newArr;
							}else if(self.targetIndex==3){
								self.hosArr = newArr;
							}
							
							
						}
						else{
							// #ifdef H5
								uni.showToast({
									title:res.data.MSG,
									icon:'none',
									duration:2000
								})
							// #endif
							setTimeout(function() {
								uni.showToast({
									title:res.data.MSG,
									icon:'none',
									duration:5000
								})
							}, 800);
							
							console.log('失败',res.data.MSG)
							self.targetIndex--;
							if(self.targetIndex<0){
								self.targetIndex = 0;
							}
							
						}
					},
					function(err){
						console.log("调用失败",err)
					},
					function(msg){
						// console.log("调用完成",msg)
						
					})
			},
			bindChange(e){
			},
			openPopup(obj){
				this.targetIndex=0;
				this.transferOut('');
				this.targetOrg = obj;
				this.$refs.popup.open();
			},
            confirmPopup(){
				var self = this;
				if(this.targetOrg!='province'){
					// 当选择医院时
					if(this.hosIndex[3]['AREA_CODE']){
						if(this.targetOrg=='out'){
							this.userInfo.ZCJGMC = this.hosIndex[3]['AREA_NAME'];
							this.userInfo.ZCJGDM = this.hosIndex[3]['AREA_CODE'];
						}else{
							this.userInfo.ZWJGMC = this.hosIndex[3]['AREA_NAME'];
							this.userInfo.ZWJGDM = this.hosIndex[3]['AREA_CODE'];
						}
						this.closePopup();
						setTimeout(function(){
							self.current = '';
							self.targetArr=[];
							self.targetIndex=0;
							self.provinceArr=[];
							self.cityArr=[];
							self.areaArr=[];
							self.hosArr=[];
							self.hosIndex=[{AREA_CODE:'',AREA_NAME:'请选择'},{AREA_CODE:'',AREA_NAME:''},{AREA_CODE:'',AREA_NAME:''},{AREA_CODE:'',AREA_NAME:''}];
						},800)
					}else{
						self.$common.errorToShow("该地区没有定点机构信息");
					}
				}
				else{
					// 当选择省份时
					var lastIndex = _.findLastIndex(this.hosIndex,function(o){
						return _.trim(o.AREA_CODE);
					});
					if(lastIndex>-1){
						var lastObj = _.nth(this.hosIndex,lastIndex);
						this.userInfo.AKC801_NAME = lastObj.AREA_NAME;
						this.userInfo.AKC801 = lastObj.AREA_CODE;
						this.closePopup();
						setTimeout(function(){
							self.current = '';
							self.targetArr=[];
							self.targetIndex=0;
							self.provinceArr=[];
							self.cityArr=[];
							self.areaArr=[];
							self.hosArr=[];
							self.hosIndex=[{AREA_CODE:'',AREA_NAME:'请选择'},{AREA_CODE:'',AREA_NAME:''},{AREA_CODE:'',AREA_NAME:''},{AREA_CODE:'',AREA_NAME:''}];
						},800)
						
					}else{
						uni.showToast({
							title:'请选择',
							image:'../../static/image/warning.png'
						})
					}
				}
			},
			closePopup(){
				this.$refs.popup.close();
				this.pageFlag = false;
				this.totalPage = 1;
				this.pageIndex = 1;
				this.hosIndex=[{AREA_CODE:'',AREA_NAME:'请选择'},{AREA_CODE:'',AREA_NAME:''},{AREA_CODE:'',AREA_NAME:''},{AREA_CODE:'',AREA_NAME:''}];
			},
			rechangeHos(index){
				this.targetIndex = index;
				this.current = this.hosIndex[index].AREA_CODE;
				this.targetArr = this.allArr[index];
				(this.hosIndex).forEach((item,n) => {
					if(n>index){
						item.AREA_CODE="";
						item.AREA_NAME="";
					}
				})
			},
			radioChange(e){
				var self = this, code = e.detail.value;
				this.current = code;
				var oldArr = this.allArr[this.targetIndex];
				var Index = _.findIndex(oldArr, ['AREA_CODE', code]);
				this.hosIndex[this.targetIndex] = _.filter(oldArr,{AREA_CODE:code})[0];
				self.targetIndex++;
				if(self.targetIndex>3){
					self.targetIndex = 3;
				}
				
				if(self.targetOrg!='province'&&self.targetIndex>0&&self.targetIndex<3&&Index=='0'){
					self.targetIndex = 3;
					self.getHospital(code);
				}
				else if(self.targetIndex<3){
					setTimeout(function(){
						var newArr = self.allArr[self.targetIndex];
						self.transferOut(code);
					},100)
				}
			},
			getHospital(code){
				var self = this;
				this.$request('S1007',{AKC801:_.trim(code),PAGENUM:self.pageIndex,PAGESIZE:50},'POST',function(resList){
					if(resList.data.CODE=='0'){
						console.log(resList);
						
						if(resList.data.DATA.length){
							self.pageFlag = true;
							self.totalPage = resList.data.PAGESIZECOUNT;
							(resList.data.DATA).forEach(item => {
								item.AREA_CODE = item.AKB020;
								item.AREA_NAME = item.AKB021;
							});
							self.targetArr  = self.hosArr = self.hosArr.concat(resList.data.DATA);
						}else{
							self.pageFlag = false;
							uni.showToast({
								title:'没有更多',
								image:'../../static/image/info.png'
							})
						}
						
						
					}else{
						self.pageFlag = false;
					}
				})
			},
			turnUp(val){
				if(this.pageIndex==1&&val==0){
					uni.showToast({
						title:'已是首页',
						image:'../../static/image/info.png'
					});
					return false;
				}
				if(this.pageIndex==this.totalPage&&val==1){
					uni.showToast({
						title:'已是尾页',
						image:'../../static/image/info.png'
					});
					return false;
				}
				if(this.pageIndex>1&&val==0){
					this.pageIndex--;
					if(this.pageIndex<1){
						this.pageIndex = 1;
					}
					this.getHospital(this.current);
				}
				
				if(this.pageIndex<this.totalPage&&val==1){
					this.pageIndex++;
					if(this.pageIndex>this.totalPage){
						this.pageIndex=this.totalPage;
					}
					this.getHospital(this.current);
				}
			},
			deleteImg(imgIndex){
				const self = this;
				if(self.userInfo.BG_FLAG = 2 ){
					self.deleteImages(imgIndex);
				}else{
					uni.showLoading({
						title:'正在删除中...'
					})
					_.pull(this.imageArr,this.imageArr[imgIndex]);
					setTimeout(function(){
						uni.hideLoading();
					},300)
				}
				
				
			},
			showCloseBtn(e){
				var self = this;
				this.currentIndex = e.currentTarget.dataset.index;
				setTimeout(function(){
					self.currentIndex = null
				},5000)
			},
            changeRenyuan(e){
				this.userInfo.AKAIndex085 = e.target.value;
				this.userInfo.AKA085 = this.renyuanArr[e.target.value].AAA102;
				this.userInfo.AKA085_NAME = this.renyuanArr[e.target.value].AAA103;
			},
			changeXianzhong(e){
				this.userInfo.AKAIndex085 = e.target.value;
				this.userInfo.AAE140  = this.xianzhongArr[e.target.value].AAA102;
				this.userInfo.AAE140_NAME= this.xianzhongArr[e.target.value].AAA103;
			},
			formateDate(val){
				var year = val.substring(0,4);
				var month = val.substring(4,6);
				var day = val.substring(6,8);
				return year+'-'+month+'-'+day;
			}
		},
		onShow() {
            var isLogin = uni.getStorageSync('isLogin'),self = this;
			this.isLogin = isLogin;
			if(isLogin){
				if(this.userInfo.BG_FLAG == 2){
					this.Loginer = uni.getStorageSync('ItemInfo');
					if (this.Loginer.IS_FJ == 1) {
						self.loadImages(this.Loginer.AAZ267,this.Loginer.AAC002)
						self.imageLoad = true;
					}
					this.userInfo.AAZ267 = this.Loginer.AAZ267;
					this.userInfo.AAC003 = this.Loginer.AAC003;	//姓名
					this.userInfo.AAC002 = this.Loginer.AAC002;	//身份证号码
					this.userInfo.AAZ500 = this.Loginer.AAZ500;	//社保卡号
					this.userInfo.AAE005 = this.Loginer.AAE005;	//电话
					this.userInfo.AAE004 = this.Loginer.AAE004;	//联系人
					this.userInfo.ZYLX	 = this.Loginer.ZYLX?this.Loginer.ZYLX:'';	//转院类型
					this.userInfo.ZWYY	 = this.Loginer.ZWYY?this.Loginer.ZWYY:'';	//转外原因
					this.userInfo.ZCJGMC = this.Loginer.ZCJGMC?this.Loginer.ZCJGMC:'';	//转出医疗机构名称
					this.userInfo.ZCJGDM = this.Loginer.ZCJGDM?this.Loginer.ZCJGDM:'',	//转出医疗机构代码
					this.userInfo.ZWJGMC = this.Loginer.ZWJGMC?this.Loginer.ZWJGMC:'';	//转往医疗机构名称
					this.userInfo.ZWJGDM = this.Loginer.ZWJGDM?this.Loginer.ZWJGDM:'';	//转往医疗机构代码
					this.userInfo.AAE030 = this.formateDate(this.Loginer.AAE030+'');		//待遇开始日期
					this.userInfo.AAE031 = this.formateDate(this.Loginer.AAE031+'');	//待遇终止日期
					this.userInfo.AAE127 = this.formateDate(this.Loginer.AAE127+'');	//申报日期
					this.userInfo.AKC803 = this.Loginer.AKC803;	//参保地行政区域代码
					this.userInfo.AKC803_NAME = this.Loginer.AKC803_NAME;
					this.userInfo.AKC801 = this.Loginer.AKC801;	//就医地行政区划代码
					this.userInfo.AKC801_NAME = this.Loginer.AKC801_NAME;//就医地行政区划名称
					this.userInfo.AAE006 = this.Loginer.AAE006;//异地居住地址
					this.userInfo.AKA085 = this.Loginer.AKA085;//人员类别
					this.userInfo.AKA085_NAME = this.Loginer.AKA085_NAME;//人员名称
					this.userInfo.AAE140 = this.Loginer.AAE140;//险种类型
					this.userInfo.AAE140_NAME = this.Loginer.AAE140_NAME;//险种类型名称
					this.userInfo.BZ = '';//备注
				}
				else{
					this.Loginer = uni.getStorageSync('userInfo');
					console.log('用户信息',this.Loginer);
					this.userInfo.AAC003 = this.Loginer.AAC003;		//姓名
					this.userInfo.AAC002 = this.Loginer.AAC002;		//身份证号码
					this.userInfo.AAZ500 = this.Loginer.AAZ500;	
					this.userInfo.AAE140 = this.Loginer.AAE140;		//险种类型
					this.userInfo.AKC803 = this.Loginer.AKC803;		//参保地行政区域代码
				}
			
				//人员类别
				this.$request('S8888',{AAA100:"AKA085"},'POST',function(res){
					if(res.data.CODE=='0'){
						console.log('人员类别',res.data.DATA)
						self.renyuanArr = res.data.DATA;
						self.userInfo.AKAIndex085 = _.findIndex(res.data.DATA,{AAA102:self.Loginer.AKA085});//人员类别序号
						
					}
				})
				
				//   险种类型
				this.$request('S8888',{AAA100:"AAE140"},'POST',function(res){
					if(res.data.CODE=='0'){
						self.xianzhongArr = res.data.DATA;
						self.userInfo.AAEIndex140 = _.findIndex(res.data.DATA,{AAA102:self.Loginer.AAE140});
						if(self.userInfo.BG_FLAG!='2'){
							self.userInfo.AAE140_NAME = _.filter(self.xianzhongArr,{AAA102:self.Loginer.AAE140})[0].AAA103;
						}
					}
				})
			}
			
		},
		onLoad(param){
			if(param.BG_FLAG==2){
				this.userInfo.BG_FLAG = param.BG_FLAG;
			}			
		}
	}
</script>

<style>
	.body{
		padding:0 10upx;
	}
	.placeholder{
		font-size: 16px;
	}
	.add-icon{
		padding:30upx 10upx;
	}
	.add-Img{
		width: 150upx;
		height: 150upx;
	}
	.image-wrap{
		padding:10upx 20upx 30upx;
		display: flex;
		justify-content: flex-start;
		flex-direction: row;
		flex-wrap: wrap;
	} 
	.image-item{
		position: relative;
		width: 180upx;
		height: 240upx;
		margin-top: 30upx;
		margin-left: 30upx;
		margin-right: 30upx;
	}
	.image-item .close{
		box-sizing: border-box;
		position: absolute;
		top: -10upx;
		left: 0;
		z-index: 99;
		width: 100%;
		height: 0upx;
		background: rgba(0,0,0,0.3);
		display: flex;
		justify-content: flex-end;
		padding-right:2upx;
		overflow: hidden;
		transition: height 0.5s ease;
	}
	.hover-image.image-item .close{
		height: 50upx;
	}
</style>
